package com.carl.zeus.dao.system;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.carl.zeus.model.system.SysUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("select * from sys_user u where u.username = #{username}")
    SysUser findByUsername(@Param("username") String username);

    @Select("select * from sys_user u where u.username = #{username} and u.password = #{password}")
    SysUser findByUsernameAndPassword(@Param("username") String username, @Param("password") String password);

    /**
     * 查询用户的所有菜单ID
     */
    List<Long> queryAllMenuId(Long userId);

    /**
     * 更改用户状态
     * @param params 参数
     */
    @Select("update sys_user set status = ${status} where id = ${id}")
    void updateUserByStatus(Map<String, Object> params);

    Long selectUserLoginNameCheck(@Param("username") String username, @Param("userId") Long userId);
}